using System.Collections.Generic;
using System.Linq;
using Blackbird.Core.Editable.Sprites;
using Blackbird.Core.Entities.Sprites;
using Microsoft.Xna.Framework.Content.Pipeline;

namespace Blackbird.Pipeline
{
    /// <summary>
    /// This class will be instantiated by the XNA Framework Content Pipeline
    /// to apply custom processing to content data, converting an object of
    /// type TInput to TOutput. The input and output types may be the same if
    /// the processor wishes to alter data without changing its type.
    ///
    /// This should be part of a Content Pipeline Extension Library project.
    ///
    /// TODO: change the ContentProcessor attribute to specify the correct
    /// display name for this processor.
    /// </summary>
    [ContentProcessor(DisplayName = "Blackbird.Pipeline.SpritePackProcessor")]
    public class SpritePackProcessor : ContentProcessor<EditableSpritePack, IEnumerable<MultiSprite>>
    {
        public override IEnumerable<MultiSprite> Process(EditableSpritePack input, ContentProcessorContext context)
        {
            var processor = new MultispriteProcessor();
            return input.Select(editableSprite => processor.Process(editableSprite, context));
        }
    }
}